home *** CD-ROM | disk | FTP | other *** search
- /*
- * a header of the class CMemoryDC
- * Copyright (C) 1997 Kazutaka Hirata <khirata@jove.acs.unt.edu>
- */
-
- #ifndef _MEMDC_H_
- #define _MEMDC_H_
-
- // stdafx.h should be included already.
-
- class CMemoryDC : public CDC {
- CBitmap* m_pBmp;
- CBitmap* m_pOldBmp;
- public:
- CMemoryDC(CDC* pSrcDC, int nWidth, int nHeight, int nBitCount) : CDC() {
- CreateCompatibleDC(pSrcDC);
-
- m_pBmp = new CBitmap;
- m_pBmp->CreateBitmap(nWidth, nHeight, 1, nBitCount, NULL);
-
- m_pOldBmp = SelectObject(m_pBmp);
- }
- virtual ~CMemoryDC(void) {
- SelectObject(m_pOldBmp);
- delete m_pBmp;
- }
- CBitmap& GetBitmap(void) {
- return *m_pBmp;
- }
- };
-
- #endif /* _MEMDC_H_ */
-